<template>
  <div>
      <el-row >
        <el-col :span="12"> 
            <!-- <table>
                <tr v-for="i in list" :key="i.id">
                   <td >
                       <a href="#" @click.prevent="fun(i.id)">{{i.name}}</a>
                       </td>
                </tr>
            </table> -->
        </el-col>
        <el-col :span="12">
            <!-- <div v-for="i in list" :key="i.id" > 
                <div v-if="i.id==id1"> -->
                    <table>
                        <tr v-for="i in list.params" :key="i.id">
                            <td v-if="i.type=='input'"> 
                                {{i.lable}}
                            <van-field :label="i.lable" />
                            </td>
                            <!-- <td v-if="i.params.type=='radio'">
                                <van-radio :name="i.id">{{i.lable}}</van-radio>
                            </td>
                            <td v-if="i.params.type=='checkbox'">
                                <van-checkbox value="{{ checked }}" >{{i.lable}}</van-checkbox>
                            </td>
                            <td v-if="i.params.type=='select'">
                                <select name="" id="">
                                    <option :value="i.id">{{i.lable}}</option>
                                </select>
                            </td>
                            <td v-if="i.params.type=='datetime'">
                                <van-cell :title="i.lable" value="{{ date }}" bind:click="onDisplay" />
                                <van-calendar show="{{ show }}" bind:close="onClose" bind:confirm="onConfirm" />
                            </td>
                            <td v-if="i.params.type=='file'">
                                <van-uploader :after-read="uploader">
                                {{i.lable}}
                                </van-uploader>
                            </td> -->

                        </tr>
                    </table>
                <!-- </div>

            </div> -->
        </el-col>
    </el-row>
  </div>
</template>

<script>
import axios from 'axios'
export default {
    name:"workindex",
    data(){
        return{
            list:[],
            checked:true,
            date: '',
            show: false,
            fileList: [],
            id:this.$route.query.id
        }
    },
    methods:{
        getworkf(){
            axios.get('/updateworkf?id='+this.id).then(res=>{
                console.log(res);
                this.list = res.data.list
            })
        },
        fun(id){
            this.id1 = id
            // alert(id)
        },
        onDisplay() {
            this.setData({ show: true });
        },
        onClose() {
                this.setData({ show: false });
            },
        formatDate(date) {
                date = new Date(date);
                return `${date.getMonth() + 1}/${date.getDate()}`;
            },
        onConfirm(event) {
                this.setData({
                show: false,
                date: this.formatDate(event.detail),
                });
            },
        uploader(file) {
            let formData = new FormData()
            formData.append('file', file.file)
            axios.post('/upload',formData).then(res => {
                    console.log(res)
        })
    },
    },
    mounted(){
        this.getworkf()
    }
}
</script>

<style>

</style>